package com.yutel.http;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class TestContentLength {

	public static void main(String[] args) {
		String url = "http://125.76.233.68/android/appstore/apps/rollny3d_v1.5_7po.apk";
		for (int i = 0; i < 100; i++) {
			testLength(url);
		}
	}

	public static void testLength(String urls) {
		try {
			URL url = new URL(urls);
			HttpURLConnection cn = (HttpURLConnection) url.openConnection();
			int code = cn.getContentLength();
			if (code < 0) {
				System.err.println("code=" + code);
			} else {
				System.out.println("code=" + code);
			}
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
